package com.action;


import com.github.binarywang.wxpay.exception.WxPayException;
import com.service.WxAppPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author jiavDad
 */
@Validated
@RestController
@RequestMapping("/wxPay")
@Slf4j
public class WxPayController {

    @Autowired
    private WxAppPayService wxPayService;

    /**
     * @param xmlData
     * @return
     * @throws WxPayException
     */
    @PostMapping("/notify/")
    @ResponseBody
    public String parseOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
        return wxPayService.parseOrderNotifyResult(xmlData);
    }


}
